<extend name="Base/base" />
<block name='head'>
    <meta charset="utf-8">
    <link href="/Public/static/dropload/dropload.css" rel="stylesheet" />
    <!--<link href="/Public/Index/css/page.css" rel="stylesheet" />-->
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
</block>
<block name="content" > 
    <div class="transferred_table">
        <table border="1">
            <!--            <tr>
                            <td>标题</td>
                            <td>发布时间</td>
                        </tr>-->
            <notempty name="news">
                <foreach name="news" item="new">
                    <tr>
                        <td style='text-align:left;padding:0 2%' <if condition="$new[url] eq null">colspan=2</if>>
                    <p>
                        <a class="newsTitle" href="{:U('show',array('news_id'=>$new['news_id']))}" title="{$new.subject}">{$new.subject}</a>
                    <if condition='$is_read == "unread"'>
                        <img src='/Public/Index/img/email_new.gif'>
                    </if>
                    </p>
                    <p class="count">点击量：{$new.click_count}</p>
                    </td>
                    <if condition="$new[url] neq null">
                        <td width='30%' style="color:#666;vertical-align: top">
                            <img src="{$new.url}" width="112px">
                            <!--<p>{$new.news_time}</p>-->
                            <!--<p>点击量：{$new.click_count}</p>-->
                        </td>
                    </if>
                    </tr>
                </foreach>
                <else />
                <tr><td colspan="5" style="text-align: left">暂无数据</td></tr>
            </notempty>
        </table>
        <!--<div class="page">{$pages}</div>-->
        <input type="hidden" id="url" value="{:U('dropload')}">
        <input type="hidden" id="delurl" value="{:U('Diary/delDiary')}">
    </div>
    <div class="button">
        <a class="am-btn back" data-url="{:U('index')}">返 回</a>
    </div>
</div>
</block>
<block name="script">
    <script type="text/javascript" src="/Public/static/dropload/dropload.js" ></script>
    <script type="text/javascript" src="/Public/Index/js/form.js"></script>
    <script type="text/javascript">
        $('.back').on('click', function () {
            location.href = $(this).attr('data-url')
        })

        $(initDelDiary());

        $(function () {
            p = 2;
            var dropload = $('.transferred_table').dropload({
                scrollArea: window,
                domDown: {
                    domClass: 'dropload-down',
                    domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                    domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                    domNoData: '<div class="dropload-noData">已无数据</div>'
                },
                loadDownFn: function (me) {
                    var url = $('#url').val() + '?p=' + p + '&is_read={$is_read}';
//                    alert(url);
                    p++;
                    $.ajax({
                        url: url,
                        type: 'get',
                        success: function (res) {
                            console.log(res)
//                            alert(res.length);
                            if (res.length > 0) {
                                var html = '';
                                for (var i = 0; i < res.length; i++) {
                                    html += '<tr><td width="60%" style="text-align:left"><a href="/index.php/Index/News/show/news_id/' + res[i].news_id + '.html" title="' + res[i].subject + '">' + res[i].subject_info + '</a></td><td><a href="/index.php/Index/News/show/news_id/' + res[i].news_id + '.html">' + res[i].news_time + '</a></td></tr>'
                                }
                                $('.transferred_table tr:last').after(html);
                            } else {
                                me.noData();
                            }
                            me.resetload();
                        }
                    })
                }
            });
        })

    </script>
</block>
